from django.conf.urls import url
from rest_framework import routers

from .views import *

urlpatterns = [
    url(r'^users/$', RegisterViews.as_view(), name='register'),
    url(r'^user/$', UserDetailViews.as_view(), name='user'),
    url(r'^usernames/(?P<username>\w{5,20})/count/$', UsernameCountViews.as_view(), name='username'),
    url(r'^mobiles/(?P<mobile>1[3-9]\d{9})/count/$', MobileCountViews.as_view(), name='mobile'),
    url(r'^email/$', EmailViews.as_view(), name='email'),
    # url(r'^addresses/$', AddressViewsSet.as_view({'post': 'create', 'get': 'list'}), name='address'),  # {'post': 'create', 'get': 'list'}
    # url(r'^addresses/(?P<pk>\d+)/$', AddressViewsSet.as_view({'delete': 'destroy'}), name='address'),  # {'delete': 'destroy'}
    # url(r'^addresses/(?P<pk>\d+)/status/$', AddressViewsSet.as_view(), name='address'),
    url(r'^browse_histories/$', UserBrowsingHistoryView.as_view(), name='browse_histories')
]
#
router = routers.DefaultRouter()
router.register(r'addresses', AddressViewsSet, base_name='addresses')

urlpatterns += router.urls
